  <%require 'htmlentities'
  coder = HTMLEntities.new
  %>
<div class="listings-container">
	<div class="refine-search-results">
    	<div class="refine-search-by">
        	Refine Search by
        </div>

        <div class="refine-search-options">
         <%@categories.each do |category| -%>
        <div class="refine-search-category">
          <%=h(category.name) -%>
        </div>
        <div class="refine-search-filters">
         <%category.sub_categories.each do |sub_category| -%>
           
         <%=link_to sub_category.name ,:action=>"results",:keyword=>params[:keyword],:university=>@university.stripped_name,:sub_category=>sub_category.stripped_name -%>
         <br>
         <%end -%>
        </div>

         <%end -%>
        </div>
    </div>
    <div class="listings-center-column" id="listings-center-column">
        <div class="listings-search">

           <% form_tag url_for(:action => "results")  do -%>
        	<div class="listings-search-title">
            	Find <%= params[:keyword] -%>
            </div>
            <div class="search-field-one">
            	<div class="search-field-name">
                	Looking for <%=params[:keyword]-%>
                </div>
                <div class="search-field-input">
                  <%if !params[:category].nil? &&params[:category]!=''
                    @stripped_name=params[:category]
                  end
                  if !params[:sub_category].nil? && params[:sub_category]!=''
                     @stripped_name=Category.find(SubCategory.find_by_stripped_name(params[:sub_category]).category_id).stripped_name
                  end -%>
                
                	 <%=select_tag "category", options_for_select(Category.find(:all,:order=>"name").collect{|x| [x.name, x.stripped_name]},:selected=>@stripped_name), :class => "search"-%>
                </div>
            </div>
            <div class="search-field-two">
            	<div class="search-field-name">
                	Keyword
                </div>
                <div class="search-field-input">
                	<input type="text" size="26" id="keyword" name="keyword" maxlength="40" class="input-boxes" value="<%=params[:keyword]%>"/>
                </div>
            </div>
            <div class="search-field-three">
            	<div class="search-field-name">
                	Locations
                </div>
                <div class="search-field-input">
                	<input type="text" size="26" id="location" name="location" maxlength="40" class="input-boxes"/>
                </div>
            </div>
            <div class="listings-search-button">

            <%#= submit_tag(image_tag("listings-search.jpg",:width=>"75px",:height=>"20px",:border=>"0px")) %>
             <%= submit_tag "Search" %>
            </div>
            <%end -%>
    	</div>

        <div id="listings-search-results-cap">
    	<%= render :partial=>"search_results" %>
        </div>

	</div>

    <div class="listings-right-column">
    	<div class="post-a-free-ad">
 	       Post a Free Ad
        </div>
    	<div class="subscribe-email">
 	       Subscribe Email
        </div>
        <div class="google-adsense">
          <%=image_tag("google-adsense.jpg",:width=>"150px",:height=>"562px",:border=>"0px") -%>

        </div>
    </div>
</div>
